﻿using gixoom.Dom.Block;

namespace gixoom.Dom.Storage.Block
{
    public interface IBlockStorage
    {
        /// <summary>
        /// Stores the specified block.
        /// </summary>
        /// <param name="block">the block</param>
        /// <returns>true if the block was successfully stored</returns>
        /// <exception cref="ArgumentNullException"><i>block</i> is a null reference.</exception>
        bool StoreBlock(IBlock block);

        /// <summary>
        /// Retrieves the block by the specified block id.
        /// </summary>
        /// <param name="blockId">the block id</param>
        /// <returns>the block by the specified block id or null if the block cannot be retrieved</returns>
        /// <exception cref="ArgumentNullException"><i>blockId</i> is a null reference.</exception>
        IBlock RetrieveBlock(IBlockId blockId);

        /// <summary>
        /// Checks whether the block with the specified block id exists.
        /// </summary>
        /// <param name="blockId">the block id to check existence of the block for</param>
        /// <returns>true if the block exists</returns>
        /// <exception cref="System.ArgumentNullException"><i>blockId</i> is a null reference.</exception>
        bool ExistsBlock(IBlockId blockId);
    }
}
